package com.googlecode.jvmpart.proc.jdbc;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public abstract class SimpleChunkProcessor<T> extends ChunkProcessor<T> {
	private static final Log logger = LogFactory.getLog(SimpleChunkProcessor.class);

	@Override
	public void allChunkProcessed(long processed, long commited) {		
		logger.info("Processed:"+processed+" Chunk:"+getCommitInterval()+" Commited:"+ commited);
	}

	@Override
	public boolean commitChunkError(List<T> chunk, Throwable t) {
		logger.debug(chunk);
		logger.warn(t, t);
		return false;
	}

	@Override
	public int getCommitInterval() {
		return 5;
	}

}
